
<!--
/**************************************************
* @ marketinfoprovider.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/05/25, Jenny
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp"%>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>

<html>
<head>
<title>供应商浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>
<%ArrayList tGSCountry = (ArrayList) request.getAttribute("country");
            ArrayList tGSProvince = (ArrayList) request
                    .getAttribute("province");
            GSProvinceBean tProvinceBean = null;
            String[][] tProvDist = null;
            HashMap tMap2 = new HashMap();
            ArrayList tGSDistinct = (ArrayList) request
                    .getAttribute("district");
            GSDistrictBean tDistrictBean = null;
            if (tGSProvince != null) {
                for (int i = 0; i < tGSProvince.size(); i++) {
                    String tProvcode = ((GSProvinceBean) tGSProvince.get(i))
                            .getGs_province_code();
                    if (tGSDistinct != null) {
                        tProvDist = new String[tGSDistinct.size()][2];
                        for (int j = 0; j < tGSDistinct.size(); j++) {
                            tDistrictBean = (GSDistrictBean) tGSDistinct.get(j);
                            if (tDistrictBean.getGs_province_code().equals(
                                    tProvcode)) {
                                tProvDist[j][0] = tDistrictBean
                                        .getGs_district_code();
                                tProvDist[j][1] = tDistrictBean
                                        .getGs_district_name();
                                tMap2.put(tProvcode, tProvDist);
                            }//end if
                        }//end for
                    }//end if
                }//end for
            }//end if	

            ResultProcess tGSProvider = (ResultProcess) request
                    .getAttribute("provider");
            String[][] tGSCorpProperty = (String[][]) request
                    .getAttribute("corpproperty");
            ArrayList tList = new ArrayList();
            String tReQuery = (String) request.getAttribute("requery");
            //out.println(message);

            %>
<script language="JavaScript">
	var counter;
	function process(val){
		if(val == 'Q' || val == 'Qre'){
				  if (val == 'Qre') {
					<%
					    if(tReQuery!=null && tReQuery.equals("true")){
					        
					%>
					   
						providerviewform.action = "<%= response.encodeURL(request.getContextPath() + "/A401104.do") %>";
                        providerviewform.submit();
                        return true;
			    	<%}%>
		    	} else if (val == 'Q') {
						providerviewform.action = "<%= response.encodeURL(request.getContextPath() + "/A401104.do") %>";
                        providerviewform.submit();
                        return true;
		    	}
    	
		}
	}
	
    function clean(){
      providerviewform.providerName.value ="";
	  providerviewform.provinceCode.value="00";		
	  var listbox = document.getElementById("districtCode");
			listbox.length = 0;
			var option = new Option();
			option.text = "---请选择城市---";
			option.value = "00";			
			listbox.options[listbox.length] = option;	
	  providerviewform.contactid.value="";
	  providerviewform.contactphone.value="";
    }
    
	function changedistrict(list){
		
  		var val = list;
		if(val=='00'){
			var listbox = document.getElementById("list3");
			listbox.length = 0;
			var option = new Option();
			option.text = "---请选择城市---";
			option.value = "0000";			
			listbox.options[listbox.length] = option;

		}else{
  	<%
  		if(tMap2 !=null){
	 	   	Collection tCollection = tMap2.keySet();
	        Iterator tIterator = tCollection.iterator();
  		       while(tIterator.hasNext()){
  		           String tKey = (String)tIterator.next();
  		           String[][] tDist = (String[][])tMap2.get(tKey);
  	%>
  				if(val == '<%=tKey%>'){
	  				var counter;
	  				var listbox = document.getElementById("list3");
	  				listbox.length = 0;  		  	  								
	<%					
						for(int n=0;n<tDist.length;n++){
						    String distCode = tDist[n][0];
						    String distName = tDist[n][1];
						    if(distCode != null){
	%>				
							var temp1 = '<%=distCode%>';
							var temp2 = '<%=distName%>';
							var option = new Option();
							option.value = temp1;
							option.text = temp2;
							listbox.options[listbox.length] = option;						
	<%
						    }
						}
	%>
  				}
  	<%
  		    }
  		       
  		}
  	%>
  	}	
	}
	
	//为系统维护和管理-产品管理 提供回写方法
	function backtoManufacturemanagepage(){
		//alert('hello');radiobutton
		//alert(radiobutton.value);
		//var temp = tokenize(radiobutton.value,'|','|');
		var ProviderName;
	    if(document.pager.providername != null){
	    	for(i=0; i<document.pager.providername.length;i++){
					if(document.pager.providername[i].checked){
						ProviderName=document.pager.providername[i].value;
							}
				         }
				    }
				  if(document.pager.providername.checked==true){
						ProviderName=document.pager.providername.value;
					}
				  //alert(orderId); 
				  if(ProviderName==null){
				   alert("请选择一个供应商。");
				   return false;
				  }   
		//alert(ProviderName);
		var temp = tokenize(ProviderName,'|','|');
		//opener.document.getElementById('type').value=temp[2];
		opener.document.getElementById('provider_name').value = temp[1];
		opener.document.getElementById('provider_id').value = temp[0];
	
		window.close();
	}
	function wclose(){
	    window.close();
	}
</script>
</head>
<body onload="process('Qre')">

<p><br>
</p>
<table width="98%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td height="20">
		<table width="98%" border="0" cellspacing="0" cellpadding="1">
			<tr height="20">
				<td height="20" width="1" class="mtxt_black">&nbsp;</td>
				<td height="30" width="758" class="mtxt_black">供应商管理</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="bg_line" height="2"></td>
	</tr>
</table>
<form name="providerviewform" method="get">

<table width="98%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td>
		<table class=bg_table id=tableId cellspacing=1 cellpadding=0
			style="padding-left:5;padding-right:5" width=100% align=center
			border=0>
			<TR height=20>
				<!-- <TD class="bg_column" align=center>供应商编号</TD>
					<TD align=left class="bg_row_odd">
					<input type="text" name="providerId" value="<%=request.getParameter("providerId")==null? "":request.getParameter("providerId") %>">
					</TD> -->
				<TD class="bg_column" align=center>供应商名称</TD>
				<TD align=left class="bg_row_odd"><input type="text"
					name="providerName"
					value="<%=request.getParameter("providerName")==null? "":request.getParameter("providerName") %>">
				</TD>
				<TD class="bg_column" align=center>国家</TD>
				<TD align=left class="bg_row_odd"><select name="countryCode">
					<%if (tGSCountry != null && tGSCountry.size() > 0) {
                for (int i = 0; i < tGSCountry.size(); i++) {
                    GSCountryBean tGSCountryBean = (GSCountryBean) tGSCountry
                            .get(i);

                    %>
					<option value="<%=tGSCountryBean.getGs_en_country_name()%>"><%=tGSCountryBean.getGs_country_name()%></option>
					<%}
            }
            else {

            %>
					<option value="00">------无------</option>
					<%}

            %>
				</select></TD>
			</TR>
			<TR height=20>
				<TD class="bg_column" align=center>省份</TD>
				<TD align=left class="bg_row_odd"><select name="provinceCode"
					onChange="changedistrict(this.value)">
					<option value="00">---请选择省份---</option>
					<%String tProvCode = request.getParameter("provinceCode");
            if (tGSProvince != null && tGSProvince.size() > 0) {
                for (int i = 0; i < tGSProvince.size(); i++) {
                    GSProvinceBean tGSProvinceBean = (GSProvinceBean) tGSProvince.get(i);
                    if (tProvCode != null
                            && tProvCode.equals(tGSProvinceBean
                                    .getGs_province_code())) {

                        %>
					<option value="<%=tGSProvinceBean.getGs_province_code()%>" selected><%=tGSProvinceBean.getGs_province_name()%></option>
					<%}
                    else {

                        %>
					<option value="<%=tGSProvinceBean.getGs_province_code()%>"><%=tGSProvinceBean.getGs_province_name()%></option>

					<%}
                }
            }

            %>

				</select></TD>
				<TD class="bg_column" align=center>城市</TD>
				<TD align=left class="bg_row_odd"><select name="districtCode"
					id="list3">
					<option value="0000">---请选择城市---</option>
					<%String tDistrCode = request.getParameter("districtCode");
            if (tProvCode != null && !tProvCode.equals("00")) {
                String[][] temp = (String[][]) tMap2.get(tProvCode);
                if (temp != null && temp.length > 0) {
                    for (int i = 0; i < temp.length; i++) {
                        if (tDistrCode != null && tDistrCode.equals(temp[i][0])) {

                            %>
					<option value="<%=temp[i][0]%>" selected><%=temp[i][1]%></option>
					<%}
                        else if (temp[i][0] != null) {

                            %>
					<option value="<%=temp[i][0]%>"><%=temp[i][1]%></option>
					<%}
                    }
                }
            }

            %>

				</select></TD>
			</TR>
			<TR height=20>
				<TD class="bg_column" align=center>联系人</TD>
				<TD align=left class="bg_row_odd"><input type="text"
					name="contactid"
					value="<%=request.getParameter("contactid")==null? "":request.getParameter("contactid") %>">
				</TD>
				<TD class="bg_column" align=center>联系电话</TD>
				<TD align=left class="bg_row_odd"><input type="text"
					name="contactphone"
					value="<%=request.getParameter("contactphone")==null? "":request.getParameter("contactphone") %>">
				</TD>
			</TR>
		</table>
		</td>
	</tr>
</table>
<%
        if (tGSProvider != null) {
        int totalRecords = 0;
                int defaultPageSize = 10;
                totalRecords = tGSProvider.getRecordsSize();
                %> 
        <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'>
        <%tList = tGSProvider.getDisplayRecords(index.intValue(),pageSize.intValue()); %>
        </page:pager>
        <%} %>
</form>
<p align="center"><input type="button" class="kuang" value="查询"
	onclick="process('Q')" />&nbsp; <input type="button" class="kuang"
	value="清空" onclick="clean()" />&nbsp;</p>
<%if (tGSProvider != null) {%>
<center>
<table width="100%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td>
        <form name='pager' method="post">
			<input type=hidden name="ProviderId">
			<input type=hidden name="providername">
			<table class=bg_table id=tableId cellspacing=1 cellpadding=2
				width=98% align=center border=0>
				<tbody>
					<tr class="bg_column" height=20>
						<td class=top align=center width="5%"></td>

						<td class=top align=center>
						<div align="center" class="txt_content">供应商名称</div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content">负责人</div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content">负责人电话</div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content">公司性质</div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content">经营范围</div>
						</td>
						<!-- <td class=top align=center> 
                        <div align="center" class="txt_content">信誉等级</div>
						</td>
						-->
						<td class=top align=center>
						<div align="center" class="txt_content">详细信息</div>
						</td>
					</tr>
					<%
                if (tList != null && tList.size() > 0) {
                    for (int i = 0; i < tList.size(); i++) {
                        GSProviderBean tStr = (GSProviderBean) tList.get(i);
                        String tTempStr = "";
                        if (i % 2 == 0) {
                            tTempStr = "class=\"bg_row_odd\"";
                        }
                        else {
                            tTempStr = "class=\"bg_row_even\"";
                        }

                        %>
					<tr <%=tTempStr%> height=20>

						<td class=top align=center>
						<div align="center" class="txt_content"><input type="radio"
							name="providername" value="<%=tStr.getGs_provider_id()+"|"+tStr.getGs_provider_name()%>|1"></div>
						</td>

						<td class=top align=center>
						<div align="center" class="txt_content"><%=tStr.getGs_provider_name()%></div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content"><%=tStr.getGs_principal_id()%></div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content"><%=tStr.getGs_principal_phone()%></div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content"><%=tStr.getGs_corp_property()%></div>
						</td>
						<td class=top align=center>
						<div align="center" class="txt_content"><%=tStr.getGs_work_scope()%></div>
						</td>
						<!-- 														
								<td class=top align=center> 
									<div align="center" class="txt_content">
									<%=tStr.getGs_credit_level()%>
									</div>
								</td>
								 -->
						<td class=top align=center>
						<div align="center" class="txt_content"><a
							href="<%= response.encodeURL(request.getContextPath() + "/A400108.do") %>?providerId=<%=tStr.getGs_provider_id()%>"
							target="blank">详细</a></div>
						</td>
					</tr>

					<%}

                %>
					<tr class="bg_column" height=20>
						<td width="960" height="16" colspan="10" align="right"><!--导航条-->
						<page:navigator type='text' queryForm="providerviewform"/></td>
					</tr>

					<%}
                else {

                %>
					<font color="red">没有符合条件的供应商</font>
					<%}

            %>
				</tbody>
			</table>
		</form>
        </td>
	</tr>
	<tr height="20">
		<td width="960" height="16" colspan="10" align="center" bgcolor="#f2f2f2">
		  <INPUT type="button" value="确定" class="kuang" onclick="return backtoManufacturemanagepage();">
		  &nbsp;<INPUT type="button" value="关闭" class="kuang" onclick="return wclose();">
	    </td>
	</tr>
</table>
</center>


<%}

        %>

<form name='writebackform'><input type='hidden'
	name='selectedproviderid' id='selectedproviderid'></form>
</body>
</html>
